import { createBrowserRouter, RouterProvider } from 'react-router-dom';
import React from 'react';
import App from '../App';
// 懒加载页面组件
const Home = React.lazy(() => import('@/pages/home'));

// 创建一个简单的关于页面组件
const About = React.lazy(() => Promise.resolve({ default: () => <div>关于页面</div> }));

// 路由配置
const router = createBrowserRouter([
  {
    path: '/',
    element: <App />,
    children: [
      // {
      //   index: true,
      //   element: <div>欢迎来到首页</div>,
      // },
      {
        index: true,
        element: <Home />,
      },
    ],
  },
]);

export default function Router() {
  return <RouterProvider router={router} />;
}
